//
// Prob.hpp for 203 Poisson in /home/druart_p/Work/math/my-math-epi/203
//
// Made by pierrick druart
// Login   <druart_p@epitech.net>
//
// Started on  Tue Mar 20 09:18:51 2012 pierrick druart
// Last update Thu May 31 14:16:11 2012 pierrick druart
//

#ifndef		__PROB__
#define		__PROB__

#include	<map>
#include	<string>
#include	<sstream>
#include	<iostream>
#include	<iomanip>
#include	<exception>

#include	"Surface.hh"

#define SIZE_TAB	5

class Prob
{
private:
  int				val_;
  int				ac;
  char				**av;
  typedef void		(Prob:: *Function)();
  std::map<int, Function>	func_;

private:
  Prob();
  Prob(const Prob&);
  Prob&	operator=(const Prob&);

public:
  Prob(int & ac, char **av);
  ~Prob();
  void	exec();
  void	verif_arg(char **av);

private:
  void	option1();
  void	option2();
  void	option3();
  void	option4();
};

class my_exception_arg : public std::exception
{
  std::string	msg;

public:
  my_exception_arg(const std::string & arg)
  {
    std::ostringstream oss;
    oss << "Wrong argument:\"" << arg << "\".";
    this->msg = oss.str();
  }
  virtual ~my_exception_arg() throw() {}
  virtual const char * what() const throw()
  {
    return this->msg.c_str();
  }
};

class my_exception_help : public std::exception
{
  std::string	msg;

public:
  my_exception_help()
  {
    std::ostringstream oss;
    oss << std::endl << "Usage : ./203poisson [n* d'option]." << std::endl;
    oss <<"Option :" << std::endl;
    oss << "1- Calcul de C(k, n), n compris entre 0 et 100 et k entre 0 et n : ./203poisson 1 [n] [k <= n]" << std::endl;
    oss << "2- Loi Binomiale, entier n et flottant p, graphique [-1, n+1, 0 ,1]: ./203poisson 2 [n] [p]" << std::endl;
    oss << "3- Loi de Probabilite discrete de Poisson, flottant n, graphique [-1, 100, 0 , 1]: ./203poisson 3 [n]" << std::endl;
    oss << "4- Similitude Loi Binomiale et Loi de Poisson : ./203poisson 4" << std::endl;
    this->msg = oss.str();
  }
  virtual ~my_exception_help() throw() {}
  virtual const char * what() const throw()
  {
    return this->msg.c_str();
  }
};


#endif /* __PROB__ */
